package com.jk.admin.dao;

import com.jk.admin.entity.Cart;
import com.jk.admin.entity.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CartDao {

    @Select("select * from t_product where product_id=#{id}")
    Product queryById(String id);

    @Insert("insert into t_cart values(0,#{user_id},#{product_id},#{product_image},#{product_name},#{product_price},#{num})")
    void addCart(Cart cart);

    @Select("select * from t_cart where user_id=#{id}")
    List<Cart> queryAll(String id);
}
